package org.example.stream;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("张无忌");
        list.add("张三丰");
        list.add("张大彪");
        list.add("吕不韦");
        list.add("张三");
        list.add("赵姬");
        list.add("张翠山");
        list.add("嫪毐");

        long z = list.stream().filter(s -> s.startsWith("张")).count();
        System.out.println(z);
        //list.stream().forEach(str-> System.out.println(str));
        list.forEach(str-> System.out.println(str));

        int[] nums = {5,34,8};
        Arrays.stream(nums).forEach(n-> System.out.println(n));
    }
}
